<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>hello react</title>
    <style></style>
  </head>
  <body>
    <div id="test"></div>
    <!-- 引入react核心库 -->
    <script src="../js/react.development.js"></script>
    <!-- 引入react Dom库 用于支持 react操作dom-->
    <script src="../js/react-dom.development.js"></script>
    <!-- 引入babel 用于将 jsx 转为 js -->
    <script src="../js/babel.min.js"></script>

    <!-- 使用babel 转译jsx -->
    <script type="text/babel">
      const data = ["React", "Vue", "Angular"];
      // React会自动便利数组但是不会自动便利对象
      // 1.创建虚拟DOM
      const VDOM = (
        <div>
          <h1>jsx练习</h1>
          <ul>
            {data.map((item, index) => {
              return <li key={index}>{item}</li>;
            })}
          </ul>
        </div>
      );

      // 渲染虚拟的
      ReactDOM.render(VDOM, document.getElementById("test"));
    </script>
  </body>
</html>
